package uestc.lj.gulishop.cart.service;

import uestc.lj.gulishop.cart.vo.Cart;
import uestc.lj.gulishop.cart.vo.CartItem;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * @Author:Crazlee
 * @Date:2021/6/11
 */
public interface CartService {
    /**
     * 将商品添加到购物车中
     *
     * @param skuId
     * @param num
     * @return
     * @throws ExecutionException
     * @throws InterruptedException
     */
    CartItem addToCart(Long skuId, Integer num) throws ExecutionException, InterruptedException;

    /**
     * 获取购物车中的某个购物项
     *
     * @param skuId
     * @return
     */
    CartItem addToCartSuccessPage(Long skuId);

    /**
     * 获取购物车
     *
     * @return
     */
    Cart getCart() throws ExecutionException, InterruptedException;

    /**
     * 清空购物车
     *
     * @param cartKey
     */
    public void clearCart(String cartKey);

    /**
     * 勾选购物项
     *
     * @param skuId
     * @param check
     */
    void checkItem(Long skuId, Integer check);

    /**
     * 计算购物项的数量
     *
     * @param skuId
     * @param num
     */
    void countItem(Long skuId, Integer num);

    /**
     * 删除商品项
     *
     * @param skuId
     */
    void deleteItem(Long skuId);

    /**
     * 获取当前登录用户的购物项
     * @return
     */
    List<CartItem> getUserCartItems();
}
